package cn.outsourcing.supermarket.mapper;

import cn.outsourcing.supermarket.bo.OrdersDataBO;
import cn.outsourcing.supermarket.common.constants.BackstageProviderConstants;
import cn.outsourcing.supermarket.common.utils.IPageUtils;
import cn.outsourcing.supermarket.dto.backstage.BackstageOrdersInfoDTO;
import cn.outsourcing.supermarket.po.HiolabsOrder;
import cn.outsourcing.supermarket.provider.BackstageHomeProvider;
import cn.outsourcing.supermarket.vo.backstage.MainInfoVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

/**
 * 后台首页 Mapper
 *
 * @author gzkemays
 * @since 2021/10/20 16:55
 */
@Mapper
public interface BackstageHomeMapper {
  /**
   * 获取首页基础数据
   *
   * @return {@link Map} 数据三大头
   */
  @SelectProvider(
      value = BackstageHomeProvider.class,
      method = BackstageProviderConstants.BACKSTAGE_HOME_BASIC_DATA_PROVIDER)
  Map<String, Long> getHomeBasicData();

  /**
   * 获取数据清单
   *
   * @param time 指定返回时间
   * @return 数据清单列表
   */
  @SelectProvider(
      value = BackstageHomeProvider.class,
      method = BackstageProviderConstants.BACKSTAGE_HOME_DETAILED_LIST_PROVIDER)
  MainInfoVO getDetailedList(@Param(value = "time") long time);

  /**
   * 根据状态获取订单列表
   *
   * @param page 分页
   * @param orderDto 订单入参信息
   * @return 订单列表
   */
  @SelectProvider(
      value = BackstageHomeProvider.class,
      method = BackstageProviderConstants.BACKSTAGE_ORDERS_DATA)
  List<OrdersDataBO> getOrdersData(
      @Param("page") IPageUtils<HiolabsOrder> page,
      @Param(value = "orderDto") BackstageOrdersInfoDTO orderDto);
}
